package com.vonchange.utils.jsp;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

public abstract class OutTag extends TagSupport {

    /**
	 *  
	 */
	private static final long serialVersionUID = 7993561430778220336L;
	
	public abstract String work(PageContext pageContext);
    @Override
    public int doStartTag() throws JspException {

        try {

            JspWriter out = this.pageContext.getOut();
            String result= work(pageContext);
            out.println(result);
        } catch(Exception e) {
           e.printStackTrace();
            throw new JspException(e.getMessage());

        }

        return SKIP_BODY;

    }

    @Override
    public int doEndTag() throws JspException {
        return EVAL_PAGE;
    }

    @Override
    public void release() {
        super.release();
    }

}